package com.smedi.ismedi.inmail.api.dto.response;

import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.time.LocalDateTime;

/**
 * 接收人
 *
 * @author 姜钦轩
 * @date 2021/08/29
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ReceiverResponse extends PersonResponse {
    /**
     * 是否已读
     */
    @ApiModelProperty(value = "是否已读")
    private Boolean isRead;
    /**
     * 查看时间
     */
    @ApiModelProperty(value = "查看时间")
    private LocalDateTime readTime;
    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    protected Integer personOrder;

    public ReceiverResponse(Long id, String name, Boolean internal, Boolean isRead, LocalDateTime readTime, OrganizationResponse organization) {
        super();
        this.id = id;
        this.name = name;
        this.internal = internal;
        this.isRead = isRead;
        this.readTime = readTime;
        this.organization = organization;
    }

    public static ReceiverResponse.ReceiverResponseBuilder builder() {
        return new ReceiverResponseBuilder();
    }

    public static class ReceiverResponseBuilder {
        private Long id;
        private String name;
        private Boolean internal;
        private Boolean isRead;
        private LocalDateTime readTime;
        private OrganizationResponse organization;

        ReceiverResponseBuilder() {
        }

        public ReceiverResponse.ReceiverResponseBuilder id(final Long id) {
            this.id = id;
            return this;
        }

        public ReceiverResponse.ReceiverResponseBuilder name(final String name) {
            this.name = name;
            return this;
        }

        public ReceiverResponse.ReceiverResponseBuilder internal(final Boolean internal) {
            this.internal = internal;
            return this;
        }

        public ReceiverResponse.ReceiverResponseBuilder isRead(final Boolean isRead) {
            this.isRead = isRead;
            return this;
        }

        public ReceiverResponse.ReceiverResponseBuilder readTime(final LocalDateTime readTime) {
            this.readTime = readTime;
            return this;
        }

        public ReceiverResponse.ReceiverResponseBuilder organization(final OrganizationResponse organization) {
            this.organization = organization;
            return this;
        }

        public ReceiverResponse build() {
            return new ReceiverResponse(this.id, this.name, this.internal, this.isRead, this.readTime, this.organization);
        }
    }
}
